3.691 \(\int \frac{(a+b \sin (e+f x))^3}{(c+d \sin (e+f x))^2} \, dx\)

Optimal. Leaf size=208 \[ \frac{b \left (-a^2 d^2+2 a b c d+b^2 \left (-\left (2 c^2-d^2\right )\right )\right ) \cos (e+f x)}{d^2 f \left (c^2-d^2\right )}-\frac{b^2 x (2 b c-3 a d)}{d^3}+\frac{2 (b c-a d)^2 \left (a c d+2 b c^2-3 b d^2\right ) \tan ^{-1}\left (\frac{c \tan \left (\frac{1}{2} (e+f x)\right )+d}{\sqrt{c^2-d^2}}\right )}{d^3 f \left (c^2-d^2\right )^{3/2}}+\frac{(b c-a d)^2 \cos (e+f x) (a+b \sin (e+f x))}{d f \left (c^2-d^2\right ) (c+d \sin (e+f x))} \]

[Out]

-((b^2*(2*b*c - 3*a*d)*x)/d^3) + (2*(b*c - a*d)^2*(2*b*c^2 + a*c*d - 3*b*d^2)*ArcTan[(d + c*Tan[(e + f*x)/2])/
Sqrt[c^2 - d^2]])/(d^3*(c^2 - d^2)^(3/2)*f) + (b*(2*a*b*c*d - a^2*d^2 - b^2*(2*c^2 - d^2))*Cos[e + f*x])/(d^2*
(c^2 - d^2)*f) + ((b*c - a*d)^2*Cos[e + f*x]*(a + b*Sin[e + f*x]))/(d*(c^2 - d^2)*f*(c + d*Sin[e + f*x]))

________________________________________________________________________________________

Rubi [A]  time = 0.495365, antiderivative size = 208, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 6, integrand size = 25, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.24, Rules used = {2792, 3023, 2735, 2660, 618, 204} \[ \frac{b \left (-a^2 d^2+2 a b c d+b^2 \left (-\left (2 c^2-d^2\right )\right )\right ) \cos (e+f x)}{d^2 f \left (c^2-d^2\right )}-\frac{b^2 x (2 b c-3 a d)}{d^3}+\frac{2 (b c-a d)^2 \left (a c d+2 b c^2-3 b d^2\right ) \tan ^{-1}\left (\frac{c \tan \left (\frac{1}{2} (e+f x)\right )+d}{\sqrt{c^2-d^2}}\right )}{d^3 f \left (c^2-d^2\right )^{3/2}}+\frac{(b c-a d)^2 \cos (e+f x) (a+b \sin (e+f x))}{d f \left (c^2-d^2\right ) (c+d \sin (e+f x))} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Sin[e + f*x])^3/(c + d*Sin[e + f*x])^2,x]

[Out]

-((b^2*(2*b*c - 3*a*d)*x)/d^3) + (2*(b*c - a*d)^2*(2*b*c^2 + a*c*d - 3*b*d^2)*ArcTan[(d + c*Tan[(e + f*x)/2])/
Sqrt[c^2 - d^2]])/(d^3*(c^2 - d^2)^(3/2)*f) + (b*(2*a*b*c*d - a^2*d^2 - b^2*(2*c^2 - d^2))*Cos[e + f*x])/(d^2*
(c^2 - d^2)*f) + ((b*c - a*d)^2*Cos[e + f*x]*(a + b*Sin[e + f*x]))/(d*(c^2 - d^2)*f*(c + d*Sin[e + f*x]))

Rule 2792

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> -S
imp[((b^2*c^2 - 2*a*b*c*d + a^2*d^2)*Cos[e + f*x]*(a + b*Sin[e + f*x])^(m - 2)*(c + d*Sin[e + f*x])^(n + 1))/(
d*f*(n + 1)*(c^2 - d^2)), x] + Dist[1/(d*(n + 1)*(c^2 - d^2)), Int[(a + b*Sin[e + f*x])^(m - 3)*(c + d*Sin[e +
 f*x])^(n + 1)*Simp[b*(m - 2)*(b*c - a*d)^2 + a*d*(n + 1)*(c*(a^2 + b^2) - 2*a*b*d) + (b*(n + 1)*(a*b*c^2 + c*
d*(a^2 + b^2) - 3*a*b*d^2) - a*(n + 2)*(b*c - a*d)^2)*Sin[e + f*x] + b*(b^2*(c^2 - d^2) - m*(b*c - a*d)^2 + d*
n*(2*a*b*c - d*(a^2 + b^2)))*Sin[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] &
& NeQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] && GtQ[m, 2] && LtQ[n, -1] && (IntegerQ[m] || IntegersQ[2*m, 2*n])

Rule 3023

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (
f_.)*(x_)]^2), x_Symbol] :> -Simp[(C*Cos[e + f*x]*(a + b*Sin[e + f*x])^(m + 1))/(b*f*(m + 2)), x] + Dist[1/(b*
(m + 2)), Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m + 2) - a*C)*Sin[e + f*x], x], x]
, x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] &&  !LtQ[m, -1]

Rule 2735

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b*x)/d
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rule 2660

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x]}, Dis
t[(2*e)/d, Subst[Int[1/(a + 2*b*e*x + a*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] &&
 NeQ[a^2 - b^2, 0]

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTan[(Rt[-b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[-b, 2]), x] /
; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rubi steps

\begin{align*} \int \frac{(a+b \sin (e+f x))^3}{(c+d \sin (e+f x))^2} \, dx &=\frac{(b c-a d)^2 \cos (e+f x) (a+b \sin (e+f x))}{d \left (c^2-d^2\right ) f (c+d \sin (e+f x))}-\frac{\int \frac{b^3 c^2-a^3 c d-3 a b^2 c d+3 a^2 b d^2-b \left (a b c^2+\left (a^2+b^2\right ) c d-3 a b d^2\right ) \sin (e+f x)+b \left (2 a b c d-a^2 d^2-b^2 \left (2 c^2-d^2\right )\right ) \sin ^2(e+f x)}{c+d \sin (e+f x)} \, dx}{d \left (c^2-d^2\right )}\\ &=\frac{b \left (2 a b c d-a^2 d^2-b^2 \left (2 c^2-d^2\right )\right ) \cos (e+f x)}{d^2 \left (c^2-d^2\right ) f}+\frac{(b c-a d)^2 \cos (e+f x) (a+b \sin (e+f x))}{d \left (c^2-d^2\right ) f (c+d \sin (e+f x))}-\frac{\int \frac{d \left (b^3 c^2-a^3 c d-3 a b^2 c d+3 a^2 b d^2\right )+b^2 (2 b c-3 a d) \left (c^2-d^2\right ) \sin (e+f x)}{c+d \sin (e+f x)} \, dx}{d^2 \left (c^2-d^2\right )}\\ &=-\frac{b^2 (2 b c-3 a d) x}{d^3}+\frac{b \left (2 a b c d-a^2 d^2-b^2 \left (2 c^2-d^2\right )\right ) \cos (e+f x)}{d^2 \left (c^2-d^2\right ) f}+\frac{(b c-a d)^2 \cos (e+f x) (a+b \sin (e+f x))}{d \left (c^2-d^2\right ) f (c+d \sin (e+f x))}+\frac{\left ((b c-a d)^2 \left (2 b c^2+a c d-3 b d^2\right )\right ) \int \frac{1}{c+d \sin (e+f x)} \, dx}{d^3 \left (c^2-d^2\right )}\\ &=-\frac{b^2 (2 b c-3 a d) x}{d^3}+\frac{b \left (2 a b c d-a^2 d^2-b^2 \left (2 c^2-d^2\right )\right ) \cos (e+f x)}{d^2 \left (c^2-d^2\right ) f}+\frac{(b c-a d)^2 \cos (e+f x) (a+b \sin (e+f x))}{d \left (c^2-d^2\right ) f (c+d \sin (e+f x))}+\frac{\left (2 (b c-a d)^2 \left (2 b c^2+a c d-3 b d^2\right )\right ) \operatorname{Subst}\left (\int \frac{1}{c+2 d x+c x^2} \, dx,x,\tan \left (\frac{1}{2} (e+f x)\right )\right )}{d^3 \left (c^2-d^2\right ) f}\\ &=-\frac{b^2 (2 b c-3 a d) x}{d^3}+\frac{b \left (2 a b c d-a^2 d^2-b^2 \left (2 c^2-d^2\right )\right ) \cos (e+f x)}{d^2 \left (c^2-d^2\right ) f}+\frac{(b c-a d)^2 \cos (e+f x) (a+b \sin (e+f x))}{d \left (c^2-d^2\right ) f (c+d \sin (e+f x))}-\frac{\left (4 (b c-a d)^2 \left (2 b c^2+a c d-3 b d^2\right )\right ) \operatorname{Subst}\left (\int \frac{1}{-4 \left (c^2-d^2\right )-x^2} \, dx,x,2 d+2 c \tan \left (\frac{1}{2} (e+f x)\right )\right )}{d^3 \left (c^2-d^2\right ) f}\\ &=-\frac{b^2 (2 b c-3 a d) x}{d^3}+\frac{2 (b c-a d)^2 \left (2 b c^2+a c d-3 b d^2\right ) \tan ^{-1}\left (\frac{d+c \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{c^2-d^2}}\right )}{d^3 \left (c^2-d^2\right )^{3/2} f}+\frac{b \left (2 a b c d-a^2 d^2-b^2 \left (2 c^2-d^2\right )\right ) \cos (e+f x)}{d^2 \left (c^2-d^2\right ) f}+\frac{(b c-a d)^2 \cos (e+f x) (a+b \sin (e+f x))}{d \left (c^2-d^2\right ) f (c+d \sin (e+f x))}\\ \end{align*}

Mathematica [A]  time = 1.05957, size = 152, normalized size = 0.73 \[ \frac{-b^2 (e+f x) (2 b c-3 a d)+\frac{2 (b c-a d)^2 \left (a c d+2 b c^2-3 b d^2\right ) \tan ^{-1}\left (\frac{c \tan \left (\frac{1}{2} (e+f x)\right )+d}{\sqrt{c^2-d^2}}\right )}{\left (c^2-d^2\right )^{3/2}}+\frac{d (a d-b c)^3 \cos (e+f x)}{(c-d) (c+d) (c+d \sin (e+f x))}+b^3 (-d) \cos (e+f x)}{d^3 f} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Sin[e + f*x])^3/(c + d*Sin[e + f*x])^2,x]

[Out]

(-(b^2*(2*b*c - 3*a*d)*(e + f*x)) + (2*(b*c - a*d)^2*(2*b*c^2 + a*c*d - 3*b*d^2)*ArcTan[(d + c*Tan[(e + f*x)/2
])/Sqrt[c^2 - d^2]])/(c^2 - d^2)^(3/2) - b^3*d*Cos[e + f*x] + (d*(-(b*c) + a*d)^3*Cos[e + f*x])/((c - d)*(c +
d)*(c + d*Sin[e + f*x])))/(d^3*f)

________________________________________________________________________________________

Maple [B]  time = 0.096, size = 842, normalized size = 4.1 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*sin(f*x+e))^3/(c+d*sin(f*x+e))^2,x)

[Out]

2/f*d^2/(c*tan(1/2*f*x+1/2*e)^2+2*tan(1/2*f*x+1/2*e)*d+c)/(c^2-d^2)/c*tan(1/2*f*x+1/2*e)*a^3-6/f*d/(c*tan(1/2*
f*x+1/2*e)^2+2*tan(1/2*f*x+1/2*e)*d+c)/(c^2-d^2)*tan(1/2*f*x+1/2*e)*a^2*b+6/f/(c*tan(1/2*f*x+1/2*e)^2+2*tan(1/
2*f*x+1/2*e)*d+c)/(c^2-d^2)*c*tan(1/2*f*x+1/2*e)*a*b^2-2/f/d/(c*tan(1/2*f*x+1/2*e)^2+2*tan(1/2*f*x+1/2*e)*d+c)
/(c^2-d^2)*c^2*tan(1/2*f*x+1/2*e)*b^3+2/f*d/(c*tan(1/2*f*x+1/2*e)^2+2*tan(1/2*f*x+1/2*e)*d+c)/(c^2-d^2)*a^3-6/
f/(c*tan(1/2*f*x+1/2*e)^2+2*tan(1/2*f*x+1/2*e)*d+c)/(c^2-d^2)*a^2*b*c+6/f/d/(c*tan(1/2*f*x+1/2*e)^2+2*tan(1/2*
f*x+1/2*e)*d+c)/(c^2-d^2)*a*b^2*c^2-2/f/d^2/(c*tan(1/2*f*x+1/2*e)^2+2*tan(1/2*f*x+1/2*e)*d+c)/(c^2-d^2)*c^3*b^
3+2/f/(c^2-d^2)^(3/2)*arctan(1/2*(2*c*tan(1/2*f*x+1/2*e)+2*d)/(c^2-d^2)^(1/2))*a^3*c-6/f*d/(c^2-d^2)^(3/2)*arc
tan(1/2*(2*c*tan(1/2*f*x+1/2*e)+2*d)/(c^2-d^2)^(1/2))*a^2*b-6/f/d^2/(c^2-d^2)^(3/2)*arctan(1/2*(2*c*tan(1/2*f*
x+1/2*e)+2*d)/(c^2-d^2)^(1/2))*a*b^2*c^3+12/f/(c^2-d^2)^(3/2)*arctan(1/2*(2*c*tan(1/2*f*x+1/2*e)+2*d)/(c^2-d^2
)^(1/2))*a*b^2*c+4/f/d^3/(c^2-d^2)^(3/2)*arctan(1/2*(2*c*tan(1/2*f*x+1/2*e)+2*d)/(c^2-d^2)^(1/2))*b^3*c^4-6/f/
d/(c^2-d^2)^(3/2)*arctan(1/2*(2*c*tan(1/2*f*x+1/2*e)+2*d)/(c^2-d^2)^(1/2))*b^3*c^2-2/f*b^3/d^2/(1+tan(1/2*f*x+
1/2*e)^2)+6/f*b^2/d^2*arctan(tan(1/2*f*x+1/2*e))*a-4/f*b^3/d^3*arctan(tan(1/2*f*x+1/2*e))*c

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(f*x+e))^3/(c+d*sin(f*x+e))^2,x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [B]  time = 2.28077, size = 2221, normalized size = 10.68 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(f*x+e))^3/(c+d*sin(f*x+e))^2,x, algorithm="fricas")

[Out]

[-1/2*(2*(2*b^3*c^6 - 3*a*b^2*c^5*d - 4*b^3*c^4*d^2 + 6*a*b^2*c^3*d^3 + 2*b^3*c^2*d^4 - 3*a*b^2*c*d^5)*f*x + (
2*b^3*c^5 - 3*a*b^2*c^4*d - 3*b^3*c^3*d^2 - 3*a^2*b*c*d^4 + (a^3 + 6*a*b^2)*c^2*d^3 + (2*b^3*c^4*d - 3*a*b^2*c
^3*d^2 - 3*b^3*c^2*d^3 - 3*a^2*b*d^5 + (a^3 + 6*a*b^2)*c*d^4)*sin(f*x + e))*sqrt(-c^2 + d^2)*log(((2*c^2 - d^2
)*cos(f*x + e)^2 - 2*c*d*sin(f*x + e) - c^2 - d^2 + 2*(c*cos(f*x + e)*sin(f*x + e) + d*cos(f*x + e))*sqrt(-c^2
 + d^2))/(d^2*cos(f*x + e)^2 - 2*c*d*sin(f*x + e) - c^2 - d^2)) + 2*(2*b^3*c^5*d - 3*a*b^2*c^4*d^2 + a^3*d^6 +
 3*(a^2*b - b^3)*c^3*d^3 - (a^3 - 3*a*b^2)*c^2*d^4 - (3*a^2*b - b^3)*c*d^5)*cos(f*x + e) + 2*((2*b^3*c^5*d - 3
*a*b^2*c^4*d^2 - 4*b^3*c^3*d^3 + 6*a*b^2*c^2*d^4 + 2*b^3*c*d^5 - 3*a*b^2*d^6)*f*x + (b^3*c^4*d^2 - 2*b^3*c^2*d
^4 + b^3*d^6)*cos(f*x + e))*sin(f*x + e))/((c^4*d^4 - 2*c^2*d^6 + d^8)*f*sin(f*x + e) + (c^5*d^3 - 2*c^3*d^5 +
 c*d^7)*f), -((2*b^3*c^6 - 3*a*b^2*c^5*d - 4*b^3*c^4*d^2 + 6*a*b^2*c^3*d^3 + 2*b^3*c^2*d^4 - 3*a*b^2*c*d^5)*f*
x + (2*b^3*c^5 - 3*a*b^2*c^4*d - 3*b^3*c^3*d^2 - 3*a^2*b*c*d^4 + (a^3 + 6*a*b^2)*c^2*d^3 + (2*b^3*c^4*d - 3*a*
b^2*c^3*d^2 - 3*b^3*c^2*d^3 - 3*a^2*b*d^5 + (a^3 + 6*a*b^2)*c*d^4)*sin(f*x + e))*sqrt(c^2 - d^2)*arctan(-(c*si
n(f*x + e) + d)/(sqrt(c^2 - d^2)*cos(f*x + e))) + (2*b^3*c^5*d - 3*a*b^2*c^4*d^2 + a^3*d^6 + 3*(a^2*b - b^3)*c
^3*d^3 - (a^3 - 3*a*b^2)*c^2*d^4 - (3*a^2*b - b^3)*c*d^5)*cos(f*x + e) + ((2*b^3*c^5*d - 3*a*b^2*c^4*d^2 - 4*b
^3*c^3*d^3 + 6*a*b^2*c^2*d^4 + 2*b^3*c*d^5 - 3*a*b^2*d^6)*f*x + (b^3*c^4*d^2 - 2*b^3*c^2*d^4 + b^3*d^6)*cos(f*
x + e))*sin(f*x + e))/((c^4*d^4 - 2*c^2*d^6 + d^8)*f*sin(f*x + e) + (c^5*d^3 - 2*c^3*d^5 + c*d^7)*f)]

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(f*x+e))**3/(c+d*sin(f*x+e))**2,x)

[Out]

Timed out

________________________________________________________________________________________

Giac [B]  time = 1.40133, size = 790, normalized size = 3.8 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(f*x+e))^3/(c+d*sin(f*x+e))^2,x, algorithm="giac")

[Out]

(2*(2*b^3*c^4 - 3*a*b^2*c^3*d - 3*b^3*c^2*d^2 + a^3*c*d^3 + 6*a*b^2*c*d^3 - 3*a^2*b*d^4)*(pi*floor(1/2*(f*x +
e)/pi + 1/2)*sgn(c) + arctan((c*tan(1/2*f*x + 1/2*e) + d)/sqrt(c^2 - d^2)))/((c^2*d^3 - d^5)*sqrt(c^2 - d^2))
- 2*(b^3*c^3*d*tan(1/2*f*x + 1/2*e)^3 - 3*a*b^2*c^2*d^2*tan(1/2*f*x + 1/2*e)^3 + 3*a^2*b*c*d^3*tan(1/2*f*x + 1
/2*e)^3 - a^3*d^4*tan(1/2*f*x + 1/2*e)^3 + 2*b^3*c^4*tan(1/2*f*x + 1/2*e)^2 - 3*a*b^2*c^3*d*tan(1/2*f*x + 1/2*
e)^2 + 3*a^2*b*c^2*d^2*tan(1/2*f*x + 1/2*e)^2 - b^3*c^2*d^2*tan(1/2*f*x + 1/2*e)^2 - a^3*c*d^3*tan(1/2*f*x + 1
/2*e)^2 + 3*b^3*c^3*d*tan(1/2*f*x + 1/2*e) - 3*a*b^2*c^2*d^2*tan(1/2*f*x + 1/2*e) + 3*a^2*b*c*d^3*tan(1/2*f*x
+ 1/2*e) - 2*b^3*c*d^3*tan(1/2*f*x + 1/2*e) - a^3*d^4*tan(1/2*f*x + 1/2*e) + 2*b^3*c^4 - 3*a*b^2*c^3*d + 3*a^2
*b*c^2*d^2 - b^3*c^2*d^2 - a^3*c*d^3)/((c^3*d^2 - c*d^4)*(c*tan(1/2*f*x + 1/2*e)^4 + 2*d*tan(1/2*f*x + 1/2*e)^
3 + 2*c*tan(1/2*f*x + 1/2*e)^2 + 2*d*tan(1/2*f*x + 1/2*e) + c)) - (2*b^3*c - 3*a*b^2*d)*(f*x + e)/d^3)/f